package com.xinxin.leetcode.problem657;

/**
 * @author ShiXinXin
 * @date 2020-02-16 23:14
 */
public class Solution {
    private static void sout(Object o) {
        System.out.println(o);
    }

    public boolean judgeCircle(String moves) {
        int x = 0, y = 0;
        for (char ch : moves.toCharArray()) {
            switch (ch) {
                case 'R':
                    x++;
                    break;
                case 'L':
                    x--;
                    break;
                case 'U':
                    y++;
                    break;
                case 'D':
                    y--;
                    break;
                default:
                    break;
            }
        }
        return x == 0 && y == 0;
    }

    public static void main(String[] args) {
        sout(null);
    }
}
